package com.md.rps.action.actions;

import com.md.rps.mybatis.model.DEPT_LEVEL_2;
import com.md.rps.service.DeptLevel2Operator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class Dept2Action {
    @Autowired
    private DeptLevel2Operator deptLevel2Operator;

    @GetMapping("dept2")
    public List<DEPT_LEVEL_2> getDept2List() {
        return deptLevel2Operator.getDeptList();
    }

    @PostMapping("addDept2")
    public int addDept(DEPT_LEVEL_2 dept_level_2) {
        return deptLevel2Operator.addDept(dept_level_2);
    }

    @PostMapping("updateDept2")
    public int updateDept(DEPT_LEVEL_2 dept_level_2) {
        return deptLevel2Operator.updateDept(dept_level_2);
    }

    @PostMapping("deleteDept2")
    public int deleteDept(@RequestParam("id")int id) {
        return deptLevel2Operator.deleteDept(id);
    }
}
